package com.hup.minicontroller.server.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class WifiStateReceiver extends BroadcastReceiver {
    private static final String TAG = WifiStateReceiver.class.getSimpleName();

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: " + intent.getAction());
//        if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(intent.getAction())) {
//            Log.i(TAG, "onReceive: ");
//            NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
//            if (info.getState().equals(NetworkInfo.State.DISCONNECTED)) {
//                Log.i(TAG, "wifi断开");
//            } else if (info.getState().equals(NetworkInfo.State.CONNECTED)) {
//                WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
//                WifiInfo wifiInfo = wifiManager.getConnectionInfo();
//                //获取当前wifi名称
//                Log.i(TAG, "连接到网络 " + wifiInfo.getSSID());
//                TtsManager ttsManager = new TtsManager();
//                ttsManager.checkTtsJet(context.getApplicationContext());
//            }
//        }
    }
}
